package com.zyj.benchmark.legacy;

import cn.hutool.core.util.RandomUtil;
import com.zyj.benchmark.test.sort.InsertSort;
import com.zyj.benchmark.test.sort.QuickSort;

/**
 *
 */
public class Novice {


    public static void main(String[] args) {
        int[] arr = new int[1000];
        for (int i = 0; i < arr.length; i++) {
            int j = RandomUtil.randomInt(1000);
            arr[i] = j;
        }
        //插入排序
        long startTime = System.currentTimeMillis();
        for (int i = 0; i < 10000; i++) {
            InsertSort.sort(arr);
        }
        long endTime = System.currentTimeMillis();
        System.out.println("插入排序10000次耗时: " + (endTime - startTime) + "ms");

        //快速排序
        long startTime1 = System.currentTimeMillis();
        for (int i = 0; i < 10000; i++) {
            QuickSort.sort(arr);
        }
        long endTime1 = System.currentTimeMillis();
        System.out.println("快速排序10000次耗时: " + (endTime1 - startTime1) + "ms");

    }
}
